package com.struts2.action;

import java.util.Date;
import java.util.Iterator;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;

import com.hibernate.HibernateUtil;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.struts2.model.Invoice;
import com.struts2.model.Invoice_item;
import com.struts2.model.Product_item;
import com.struts2.model.Product_line;
import com.struts2.service.InvoiceService;
import com.struts2.service.ProductDetailService;
import com.struts2.service.ProductSearchService;

public class SellGraphAction extends ActionSupport{


	private List<Invoice_item> invoice_items;
	private List<Invoice> invoice;
	public int sellCount = 0;
	
	public String execute() {

		InvoiceService is = new InvoiceService();
		invoice = is.Invoice(invoice);
		invoice_items = is.InvoiceItem(invoice_items);

		for(Iterator it = invoice.iterator(); it.hasNext(); ) {
			
			Invoice iv = (Invoice) it.next();
			
			System.out.println(iv.getId() +" " + iv.getMailing_address());    
			sellCount++;
			
		}
		return SUCCESS;
	}
	
	public List<Invoice_item> getInvoice_items() {
		return invoice_items;
	}

	public void setInvoice_items(List<Invoice_item> invoice_items) {
		this.invoice_items = invoice_items;
	}

	public List<Invoice> getInvoice() {
		return invoice;
	}

	public void setInvoice(List<Invoice> invoice) {
		this.invoice = invoice;
	}

	

}

